package com.rjkj.medicalwaste.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.rjkj.medicalwaste.bean.PackBean
import com.rjkj.medicalwaste.bean.PackGroupByDepartmentBean
import com.rjkj.medicalwaste.databinding.ItemWaitPackBinding

class WaitPackAdapter(
    var list: List<PackGroupByDepartmentBean>,
) : RecyclerView.Adapter<WaitPackAdapter.ViewHolder>() {
    class ViewHolder(private val binding: ItemWaitPackBinding) :
        RecyclerView.ViewHolder(binding.root) {
        fun bind(
            item: PackGroupByDepartmentBean,
        ) {
            binding.item = item
            binding.executePendingBindings()
        }
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        val test = list[position]
        holder.bind(test)
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val binding = ItemWaitPackBinding.inflate(
            LayoutInflater.from(parent.context),
            parent,
            false
        )
        return ViewHolder(binding)
    }

    override fun getItemCount(): Int {
        return list.size
    }
}